package com.tungse.eventTest;

import com.tungse.eventTest.pojo.MessageEvent;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;

/**
 * @author Tungse
 */
@Setter
@Service
public class EventServiceImpl {

    @Autowired
    private ApplicationContext applicationEventPublisher;

    public void notify(String code, String message) {
        applicationEventPublisher.publishEvent(new MessageEvent<>(message, code));
    }
}
